<html> 
<%= form_tag("search", :method => "get") do %>
  <%= text_field_tag(:query, "#{@query}", :style => "height:40px;",
  									 :placeholder => 'Search') %>
  <%= submit_tag('Search', :class => 'btn pull-right', :style => "height:40px;",) %>
<% end %>
	<% unless @friends.empty? %>
 <ul class="nav nav-list">
	<table style="width:100%;">
		<tr>
 	<td align="left"><font size = "4"><b align ="left">Your Friends</b></font></td>
	<td  align="right">	<%= link_to 'Blocked friends', {:controller => 'users', :action => 'manage_blocked_friends'}, 
		class: "btn"%></td>
		</tr></table>
	</ul>
		<ul class="nav nav-list ">
			<% @friends.each do |friend| %>
				<li class="divider"></li>
				<li> <b><%= if friend.name.nil?  then friend.email.split('@').first else friend.name + " (#{friend.email})" end %> </b></li>
				<div align="right">
				<% if @user.pending_invited.include? friend%>
					<%=	link_to 'Remove request',{:controller => 'friendships',
												:action => 'remove_request', 
												:friend_id => friend.id}, 
												class: "btn btn-warning" 	
					%>					
				<% else %>
					<%=	link_to 'Remove',{:controller => 'friendships',
												:action => 'remove', 
												:friend_id => friend.id}, 
												class: "btn btn-danger" 	
					%>
					<%= link_to 'Feed', {:controller => 'users',
											  :action => 'friends_feed',
											  :id => friend.id}, 
												class: "btn"%>
					<% if @user.blocked? friend %>
						<%= link_to 'Unblock', {:controller => 'friendships',
											  :action => 'unblock',
											  :friend_id => friend.id}, 
												class: "btn btn-warning"%>
					<% else %>
						<%= link_to 'Block', {:controller => 'friendships',
											  :action => 'block',
											  :friend_id => friend.id}, 
												class: "btn btn-warning"%>

					<% end %>												

				<% end %>
				</div>

			<% end %>	
		</ul>
	<% end %>
	<% if not @friends.empty? %>
		<div class="apple_pagination">
			<%= will_paginate @friends, :container => false %>
		</div>
	<% end %>

</html>
